// import com.alibaba.druid.sql.ast.SQLExpr;
// import com.alibaba.druid.sql.ast.SQLObject;
// import com.alibaba.druid.sql.dialect.oracle.ast.OracleSQLObjectImpl;
// import com.alibaba.druid.sql.dialect.oracle.visitor.OracleASTVisitor;

// import java.util.Arrays;
// import java.util.List;

#include "OracleRangeExpr.h"
#include "../../../../ast/SQLObject.h"
#include "../../visitor/OracleASTVisitor.h"

OracleRangeExpr::OracleRangeExpr()
{
}

OracleRangeExpr::OracleRangeExpr(SQLExpr_ptr lowBound, SQLExpr_ptr upBound)
{
  setLowBound(lowBound);
  setUpBound(upBound);
}

// @Override
void OracleRangeExpr::accept0(OracleASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(OracleRangeExpr)))
  {
    acceptChild(visitor, lowBound);
    acceptChild(visitor, upBound);
  }
  visitor->endVisit(SharedObject(OracleRangeExpr));
}

SQLObject_list_ptr OracleRangeExpr::getChildren()
{
  SQLObject_list_ptr tmp = std::make_shared<std::list<SQLObject_ptr>>();
  tmp->push_back(this->lowBound);
  tmp->push_back(this->upBound);
  return tmp;
}

SQLExpr_ptr OracleRangeExpr::getLowBound()
{
  return lowBound;
}

void OracleRangeExpr::setLowBound(SQLExpr_ptr lowBound)
{
  if (lowBound != nullptr)
  {
    lowBound->setParent(SharedObject(OracleRangeExpr));
  }
  this->lowBound = lowBound;
}

SQLExpr_ptr OracleRangeExpr::getUpBound()
{
  return upBound;
}

void OracleRangeExpr::setUpBound(SQLExpr_ptr upBound)
{
  if (upBound != nullptr)
  {
    upBound->setParent(SharedObject(OracleRangeExpr));
  }
  this->upBound = upBound;
}

SQLObject_ptr OracleRangeExpr::clone()
{
  SQLObject_ptr clone_tmp = std::shared_ptr<OracleRangeExpr>(new OracleRangeExpr());
  std::shared_ptr<OracleRangeExpr> x = std::dynamic_pointer_cast<OracleRangeExpr>(clone_tmp);
  // OracleRangeExpr x = new OracleRangeExpr();

  if (lowBound != nullptr)
  {
    x->setLowBound(std::dynamic_pointer_cast<SQLExpr>(lowBound->clone()));
  }

  if (upBound != nullptr)
  {
    x->setUpBound(std::dynamic_pointer_cast<SQLExpr>(upBound->clone()));
  }

  return x;
}
